Borland Online And The Cobb Group Present:


January, 1996 - Vol. 3 No. 1

Windows 95 Development - An overview of Windows 95 icon usage

by Jim Ross

Until the advent of Windows 95, by default Windows used a single icon in Program Manager to identify an application in both its normal and minimized settings, as well as the documents created by that application. Windows 95 changes all of that. Now an application needs to supply icons for itself and for each type of document or object it can edit or create. Furthermore, it must furnish each of these icons in more than one size. In this article, we'll give you an overview of the new Windows 95 icon requirements, and we'll explain how Windows 95 uses different-sized icons.

What icons do you need?

Your application should supply a unique icon to represent each document type, data type, or object type that it can create or edit. As a result, some applications have quite a large number of icons. Figure A shows the icons provided in the Office 95 version of Microsoft Excel, many of which represent OLE Automation objects that Excel can create.


Figure A - Icons can help differentiate document and object types.

Notice how you can easily distinguish that each of the icons in Figure A has something to do with Excel. At the same time, you'll find subtle differences between the icons, indicating that each represents a distinct document or object type. In the case of Excel, only two of the icons represent document types; the others represent OLE Automation objects.

Icon sizes

Earlier versions of Windows utilized one icon size­䎴x32 pixels­­and in general used the same icon to represent an application and the documents it created. Windows 95 uses three different icon sizes: 16x16, 32x32, and 48x48 pixels. Figure B shows all three sizes side by side to give you a feel for their relative appearance.


Figure B - The 32x32-pixel icon is the standard icon size, but Windows 95 makes use of the 16x16-pixel icon in places like the Task Bar.

Table A shows where Windows 95 uses each of the three icon sizes and what action Windows 95 takes if an icon isn't supplied. Don't be lulled by the fact that Windows 95 expands or shrinks your normal 32x32 icon as needed. Some icon designs don't shrink gracefully but instead turn into indistinguishable blobs.

Table A: Icon usage summary
Size Usage notes
16x16
  • Used for the Start menu, the Task Bar, the upper-left corner of main and MDI windows, and the Small Icon view in Explorer and folders.


  • If this size isn't available, Win95 shrinks the 32x32 icon.
32x32
  • Used for the Desktop, the [Alt][Tab] hot-key bar, and the Large Icon view in Explorer and folders.


  • This is the default size, and you must provide it.
48x48
  • Used in place of the 32x32 icon whenever the user sets Display Properties Appearance to larger than 40x40 pixels.


  • If this size isn't available, Win95 expands the 32x32 icon.

Let's see what happens if you forget to create a particular image size in an existing icon. Figures C and D show two different view settings for a folder and illustrate what happens in different circumstances. In this example, the folder contains two applications, calc1 and calc2.Figure C shows the folder set to display normal (32x32-pixel) icons. Figure D shows the folder set to display small (16x16-pixel) icons. Look closely at the icons shown in Figure D.


Figure C - Windows 95 in normal icon format displays 32x32-pixel icons.

The icon for calc1 in Figure D is based on the default 32x32-pixel icon. The application calc1 provides only a 32x32-pixel image, so Windows 95 has attempted to shrink that image to use as a 16x16-pixel image. Note how the detail of the 32x32 image has disappeared into a vague blur in the 16x16 version.


Figure D - Windows 95 in small icon or list format displays 16x16-pixel icons.

The icon for calc2 shows what happens when a 16x16 image is included in the icon file. The 32x32-pixel image is the same as the one for calc1, but we've tailored the 16x16-pixel image so that it looks good when displayed.

What about larger icons?

Most programmers ignore the 48x48-pixel image size altogether. Few are even aware of the large icon format because AppExpert doesn't furnish a default 48x48 icon as it does the 16x16 image. (Remember that when no image of a requested size is present in an icon file, Windows 95 will scale the closest available size to fit.) Expanding a 32x32-pixel icon to a larger format will usually yield much more acceptable results than does shrinking an icon from 32x32 to 16x16 pixels.

Windows 95 can display icons in sizes other than the three we've discussed. One of the Display Appearance options allows you to change the default display size for icons. To see this setting, right-click an empty space on the desktop to bring up the Desktop pop-up menu; then choose Properties. In the resultant Display Properties dialog box, choose the Appearance tab; then, pull down the Item dropdown list and choose Icon. Doing so will activate the Size control, as shown in Figure E.


Figure E - If your application doesn't provide an icon matching the default display size, Windows 95 will scale the closest available size to fit.

The Display Properties dialog box will let you set the default icon size to any value from 0 on up, but sizes lower than 16 default to 16 pixels, and sizes larger than 72 default to 72 pixels. If your application doesn't have an icon of the chosen size, Windows 95 will scale the closest available icon in your application to fit.

Conclusion

In this article, we've taken a look at Windows 95's new icon requirements. Now that you know how Windows 95 uses different icon sizes, you can make better use of icons to keep your applications looking sharp.

Jim Ross works at NationsBank in Dallas, where he develops applications using Visual C++ and MFC. He is the author of two books and numerous magazine articles on Visual C++ programming. He was recently named a Microsoft MVP (Most Valued Professional) in the MSMFC and MSLANG forums on CompuServe. You can reach him on CompuServe at 72333,2046.

Return to the Borland C++ Developer's Journal index

Subscribe to the Borland C++ Developer's Journal


Copyright (c) 1996 The Cobb Group, a division of Ziff-Davis Publishing Company. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of Ziff-Davis Publishing Company is prohibited. The Cobb Group and The Cobb Group logo are trademarks of Ziff-Davis Publishing Company.